<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Bind a lob object or a string as a lob object to a prepared statement as parameters</title>
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-base.css" />
<link media="all" rel="stylesheet" type="text/css" href="styles/03e73060321a0a848018724a6c83de7f-theme-medium.css" />

 </head>
 <body class="docs"><div class="navbar navbar-fixed-top">
  <div class="navbar-inner clearfix">
    <ul class="nav" style="width: 100%">
      <li style="float: left;"><a href="function.cubrid-lob-size.html">« cubrid_lob_size</a></li>
      <li style="float: right;"><a href="function.cubrid-lob2-close.html">cubrid_lob2_close »</a></li>
    </ul>
  </div>
</div>
<div id="breadcrumbs" class="clearfix">
  <ul class="breadcrumbs-container">
    <li><a href="index.html">PHP Manual</a></li>
    <li><a href="ref.cubrid.html">CUBRID 函数</a></li>
    <li>Bind a lob object or a string as a lob object to a prepared statement as parameters</li>
  </ul>
</div>
<div id="layout">
  <div id="layout-content"><div id="function.cubrid-lob2-bind" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">cubrid_lob2_bind</h1>
  <p class="verinfo">(PECL CUBRID &gt;= 8.4.1)</p><p class="refpurpose"><span class="refname">cubrid_lob2_bind</span> &mdash; <span class="dc-title">Bind a lob object or a string as a lob object to a prepared statement as parameters</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-function.cubrid-lob2-bind-description">
  <h3 class="title">说明</h3>
  <div class="methodsynopsis dc-description">
   <span class="methodname"><strong>cubrid_lob2_bind</strong></span>(<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">resource</span> <code class="parameter">$req_identifier</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">int</span> <code class="parameter">$bind_index</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type"><a href="language.types.declarations.html#language.types.declarations.mixed" class="type mixed">mixed</a></span> <code class="parameter">$bind_value</code></span>,<br>&nbsp;&nbsp;&nbsp;&nbsp;<span class="methodparam"><span class="type">string</span> <code class="parameter">$bind_value_type</code><span class="initializer"> = ?</span></span><br>): <span class="type">bool</span></div>

  <p class="para rdfs-comment">
   The <span class="function"><strong>cubrid_lob2_bind()</strong></span> function is used to bind BLOB/CLOB datas
   to a corresponding question mark placeholder in the SQL statement that was passed 
   to <span class="function"><a href="function.cubrid-prepare.html" class="function">cubrid_prepare()</a></span>. If <code class="parameter">bind_value_type</code> 
   is not given, string will be &quot;BLOB&quot; as the default. But if you use
   <span class="function"><a href="function.cubrid-lob2-new.html" class="function">cubrid_lob2_new()</a></span> before, <code class="parameter">bind_value_type</code>
   will be consistent with <code class="parameter">type</code> in <span class="function"><a href="function.cubrid-lob2-new.html" class="function">cubrid_lob2_new()</a></span> as the default.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-function.cubrid-lob2-bind-parameters">
 <h3 class="title">参数</h3>
 <p class="para">
  <dl>
   
    <dt>
<code class="parameter">req_identifier</code></dt>

    <dd>

     <p class="para">Request identifier as a result of <span class="function"><a href="function.cubrid-prepare.html" class="function">cubrid_prepare()</a></span>.</p>
    </dd>

   
   
    <dt>
<code class="parameter">bind_index</code></dt>

    <dd>

     <p class="para">Location of binding parameters. It starts with 1.</p>
    </dd>

   
   
    <dt>
<code class="parameter">bind_value</code></dt>

    <dd>

     <p class="para">Actual value for binding.</p>
    </dd>

   
   
    <dt>
<code class="parameter">bind_value_type</code></dt>

    <dd>

     <p class="para">It must be &quot;BLOB&quot; or &quot;CLOB&quot; and it won&#039;t be case-sensitive. If it not be given, the default value is &quot;BLOB&quot;.</p>
    </dd>

   
  </dl>

  </p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-function.cubrid-lob2-bind-returnvalues">
  <h3 class="title">返回值</h3>
  <p class="para">
   成功时返回 <strong><code>true</code></strong>， 或者在失败时返回 <strong><code>false</code></strong>。
  </p>
 </div>

 
 <div class="refsect1 examples" id="refsect1-function.cubrid-lob2-bind-examples">
  <h3 class="title">范例</h3>
  <div class="example" id="example-1152">
   <p><strong>示例 #1 <span class="function"><strong>cubrid_lob2_bind()</strong></span> example</strong></p>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br /></span><span style="color: #FF8000">//&nbsp;Table:&nbsp;test_lob&nbsp;(id&nbsp;INT,&nbsp;contents&nbsp;CLOB)<br /><br /></span><span style="color: #0000BB">$conn&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"localhost"</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">33000</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"demodb"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"dba"</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">""</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cubrid_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,</span><span style="color: #DD0000">"DROP&nbsp;TABLE&nbsp;if&nbsp;exists&nbsp;test_lob"</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">cubrid_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,</span><span style="color: #DD0000">"CREATE&nbsp;TABLE&nbsp;test_lob&nbsp;(id&nbsp;INT,&nbsp;contents&nbsp;CLOB)"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$req&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_prepare</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">"INSERT&nbsp;INTO&nbsp;test_lob&nbsp;VALUES&nbsp;(?,&nbsp;?)"</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cubrid_bind</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">,</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">3</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">$lob&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">cubrid_lob2_new</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'CLOB'</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">cubrid_lob2_bind</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">$lob</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cubrid_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cubrid_bind</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">1</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">4</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cubrid_lob2_bind</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">,&nbsp;</span><span style="color: #0000BB">2</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'CUBRID&nbsp;LOB2&nbsp;TEST'</span><span style="color: #007700">,&nbsp;</span><span style="color: #DD0000">'CLOB'</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cubrid_execute</span><span style="color: #007700">(</span><span style="color: #0000BB">$req</span><span style="color: #007700">);<br /><br /></span><span style="color: #0000BB">cubrid_disconnect</span><span style="color: #007700">(</span><span style="color: #0000BB">$conn</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

  </div>
 </div>


 <div class="refsect1 seealso" id="refsect1-function.cubrid-lob2-bind-seealso">
  <h3 class="title">参见</h3>
  <p class="para">
   <ul class="simplelist">
   <li class="member"><span class="function"><a href="function.cubrid-lob2-new.html" class="function" rel="rdfs-seeAlso">cubrid_lob2_new()</a> - Create a lob object</span></li>
   <li class="member"><span class="function"><a href="function.cubrid-lob2-close.html" class="function" rel="rdfs-seeAlso">cubrid_lob2_close()</a> - Close LOB object</span></li>
   </ul>
  </p>
 </div>


</div></div></div></body></html>